import { get,post } from './request'

const HttpManager= {
    getAllPeople: () => get('proxy_1/people/selectPeople'),
    updatePeople:(people) => post('proxy_1/people/updatePeople',people),
    getAllLogDate:() =>get('proxy_1/people/selectLogDate'),
    getAllLeavePeople:()=>get('proxy_1/people/selectLeavePeople'),
    deletePeople:(peopleID) => post('proxy_1/people/deleteOnePeople',peopleID),
    deleteLeavePeople:(peopleID) => post('proxy_1/people/comeBack',peopleID),
    logIn:(peopleID) => post('proxy_1/manager/logIn',peopleID),
    justSearch:(tiaoJian) => post('proxy_1/manager/justSearch',tiaoJian)
}

const DateTurn ={
    timeToString: (time)=>{
    let datetime = new Date();
    datetime.setTime(time);
    let year = datetime.getFullYear();
    let month = datetime.getMonth() + 1 < 10 ? "0" + (datetime.getMonth() + 1)
        : datetime.getMonth() + 1;
    let date = datetime.getDate() < 10 ? "0" + datetime.getDate() : datetime
        .getDate();
   /* let hour = datetime.getHours() < 10 ? "0" + datetime.getHours() : datetime
        .getHours();
    let minute = datetime.getMinutes() < 10 ? "0" + datetime.getMinutes()
        : datetime.getMinutes();
    let second = datetime.getSeconds() < 10 ? "0" + datetime.getSeconds()
        : datetime.getSeconds();*/
    return year + "-" + month + "-" + date;
    }
}



export {HttpManager,DateTurn}
